package com.suyl.candy.impexcel.constant;

/**
 * @version v1.0
 * @author: suyl
 * @time: 2020/4/22 16:43
 * @description: candy
 **/
public enum Constants {

    HUJ("1", "回家"), // 1
    JAY("2", "加油"), // 2
    HUF("3", "话费"), // 3
    SHY("4", "生活用品"), // 4
    HZP("5", "化妆品"), // 5
    YIF("6", "衣服"), // 6
    LIS("7", "零时"), // 7
    GOZ("8", "工资"), // 8
    QIT("9", "其他"), // 9
    WIZ("10", "未知"), // 10
    CHD("11", "车贷"), // 11
    FAD("12", "房贷"), // 12
    ZSD("13", "招商贷"), // 13
    SJD("14", "手机贷"),// 13
    JAVAD("15", "JAVA学习贷"); // 13

    // 成员变量
    private String key;
    private String value;

    Constants(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static Constants getConstantsByKey(String key) {
        Constants[] constants = values();
        for (Constants constant : constants) {
            if (constant.getKey().equals(key)) {
                return constant;
            }
        }
        return null;
    }

    public static Constants getConstantsByValue(String value) {
        Constants[] constants = values();
        for (Constants constant : constants) {
            if (constant.getValue().equals(value)) {
                return constant;
            }
        }
        return WIZ;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
